home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 for Intel / NeXTSTEP 3.2 for Intel.iso / NextLibrary / Documentation / Sybase / DBLIB / Section2 / dbbylist.nr < prev    next >
Encoding:
Text File  |  1993-04-22  |  2.4 KB  |  80 lines

  1. .Na "dbbylist" 
  2. .Aa
  3. .Fu
  4. Return the bylist for a compute row.
  5. .Ih "bylist, returning"
  6. .Sy
  7. .Sf "BYTE *dbbylist(dbproc, computeid, size)"
  8. .Sp "DBPROCESS" "*dbproc"
  9. .Sp "int" "computeid"
  10. .Sp "int" "*size"
  11. .Co
  12. .Bl
  13. .I "dbbylist()"
  14. returns the bylist for a compute row.
  15. (A SELECT statement's COMPUTE clause may contain
  16. the keyword BY, followed by a list of columns.
  17. This list, known as the ``bylist,'' divides the results
  18. into subgroups, based on changing values in the specified columns.
  19. The COMPUTE clause's row aggregate is applied to each subgroup, 
  20. generating a compute row for each subgroup.)
  21. .Bl
  22. .I "dbresults()"
  23. must return SUCCEED before the application calls this routine.
  24. .Bl
  25. Assume the following command has been executed:
  26. .SD
  27. .in +5n
  28. .ne 3
  29. select dept, name, year, sales from employee
  30.     order by dept, name, year
  31.     compute count(name) by dept,name
  32. .in -5n
  33. .ED
  34. The call
  35. .I "dbbylist(dbproc, 1, &size)"
  36. sets \f2size\f1 to 2, because there are two items in the bylist.
  37. It returns a pointer to an array of two BYTES, which contain
  38. the values 1 and 2, indicating that the bylist is composed of
  39. columns 1 and 2 from the \f2select-list\f1.
  40. .Bz
  41. .Pa
  42. .Pi dbproc
  43. A pointer to the DBPROCESS structure that provides the connection
  44. for a particular front-end/\*S process.  It contains all the
  45. information that \*L uses to manage communications and data between the
  46. front end and \*S.
  47. .Pi computeid
  48. The id that identifies the particular compute row of interest.
  49. A SQL SELECT statement may have multiple COMPUTE clauses, 
  50. each of which returns a separate compute row.
  51. The \f2computeid\f1 corresponding to the
  52. first COMPUTE clause in a SELECT is 1.
  53. The \f2computeid\f1 is returned by \f2dbnextrow()\f1 
  54. or \f2dbgetrow().\f1
  55. .Pi size
  56. A pointer to an integer, which
  57. .I "dbbylist()"
  58. sets to the number of elements in the bylist.
  59. .in -.375i
  60. .Re
  61. .br
  62. A pointer to an array of BYTEs containing the numbers of the columns that compose
  63. the bylist for the specified compute.
  64. The array of BYTEs is part of the DBPROCESS, so you must not free it.
  65. If the \f2computeid\f1 is out of range, NULL is returned.
  66. .sp 0.5v
  67. Call \f2dbcolname()\f1 to derive the name of a column from its number.
  68. .sp 0.5v
  69. The size of the array is returned in the \f2size\f1 parameter.
  70. A \f2size\f1 of 0 indicates that either there is no bylist for this particular
  71. compute or the \f2computeid\f1 is out of range.
  72. .Sa
  73. dbadata,
  74. dbadlen,
  75. dbaltlen,
  76. dbalttype,
  77. dbcolname,
  78. dbgetrow,
  79. dbnextrow
  80.